<?php session_start();
include "constants.php";

if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) {
	$CheckEmail = stripslashes(strip_tags($_POST['email']));
} else {$CheckEmail = '';}
if ((isset($_POST['pwd'])) && (strlen(trim($_POST['pwd'])) > 0)) {
	$pwd = md5(stripslashes(strip_tags($_POST['pwd'])));
} else {$pwd = md5('');}
if ((isset($_POST['fName'])) && (strlen(trim($_POST['fName'])) > 0)) {
	$fName = stripslashes(strip_tags($_POST['fName']));
} else {$fName = '';}
if ((isset($_POST['lName'])) && (strlen(trim($_POST['lName'])) > 0)) {
	$lName = stripslashes(strip_tags($_POST['lName']));
} else {$lName = '';}


//$CheckEmail=$_POST['email'];
$_SESSION['PWD']=$pwd;
$_SESSION['FirstName']=$_POST['fName'];
$_SESSION['Email']=$_POST['email'];

if(!isset($_SESSION['Email']))
{echo "You are in the wrong page since this is not "."<a href='apply.php'>www.cash2u.ca</a>". " application page, please start your ". "<a href='apply.php'>application here</a> now, thank you for your cooperation!";
exit();
}


$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD); 

if (!$link) { 
    die('Could not connect: ' . mysql_error()); 
} 
mysql_select_db(DB_NAME);


$sqlEmail = "SELECT * FROM MainTable WHERE UserName = '$CheckEmail'";

$resultemail=mysql_query($sqlEmail);
$RowEmail=mysql_num_rows($resultemail);

if ($RowEmail!=0) 
{
echo "<b style='color:black;'>"."Attention please:<b><br/><br/>";
echo "<p style='color:blue;'>Since this email address is already in our system, please ". "<a href='member.php'>apply here </a>". " as a returning customer<br/><br/>". "If you still want to apply as a new customer, please use another email address and "."<a href='apply.php'>"." apply here now</a><p>";
exit();
}

$sqlcoup = "SELECT Rate FROM `Promotion` WHERE PID= '1'";
$sqlcoupre=mysql_query($sqlcoup);
$rowcoup = mysql_fetch_array($sqlcoupre);
$temp=$rowcoup['Rate'];
$coup=sprintf("%1\$.2f",$temp);

$NewCustomer=$_SESSION['NewCusts'];
//$temp=$_SESSION['result'];
//$coup=sprintf("%1\$.2f",$temp);
$PPP=$_SESSION['ppp'];

//$link = mysql_connect('cash2uca.ipagemysql.com', 'cash2uca', 'actW3740!@#$'); 
//if (!$link) { 
//    die('Could not connect: ' . mysql_error()); 
//} 

if ((isset($_POST['gender'])) && (strlen(trim($_POST['gender'])) > 0)) {
	$gender = stripslashes(strip_tags($_POST['gender']));
} else {$gender = '';}
if ((isset($_POST['birthdate'])) && (strlen(trim($_POST['birthdate'])) > 0)) {
	$birthdate = stripslashes(strip_tags($_POST['birthdate']));
} else {$birthdate = '';}
if ((isset($_POST['address'])) && (strlen(trim($_POST['address'])) > 0)) {
	$address = stripslashes(strip_tags($_POST['address']));
} else {$address = '';}
if ((isset($_POST['city'])) && (strlen(trim($_POST['city'])) > 0)) {
	$city = stripslashes(strip_tags($_POST['city']));
} else {$city = '';}
if ((isset($_POST['mprovince'])) && (strlen(trim($_POST['mprovince'])) > 0)) {
	$mprovince = stripslashes(strip_tags($_POST['mprovince']));
} else {$mprovince = '';}
if ((isset($_POST['postcode'])) && (strlen(trim($_POST['postcode'])) > 0)) {
	$postcode = stripslashes(strip_tags($_POST['postcode']));
} else {$postcode = '';}
if ((isset($_POST['datein'])) && (strlen(trim($_POST['datein'])) > 0)) {
	$datein = stripslashes(strip_tags($_POST['datein']));
} else {$datein = '';}
if ((isset($_POST['primaryphone'])) && (strlen(trim($_POST['primaryphone'])) > 0)) {
	$primaryphone = stripslashes(strip_tags($_POST['primaryphone']));
} else {$primaryphone = '';}
if ((isset($_POST['workphone'])) && (strlen(trim($_POST['workphone'])) > 0)) {
	$workphone = stripslashes(strip_tags($_POST['workphone']));
} else {$workphone = '';}
if ((isset($_POST['cellphone'])) && (strlen(trim($_POST['cellphone'])) > 0)) {
	$cellphone = stripslashes(strip_tags($_POST['cellphone']));
} else {$cellphone = '';}
if ((isset($_POST['email'])) && (strlen(trim($_POST['email'])) > 0)) {
	$email = stripslashes(strip_tags($_POST['email']));
} else {$email = '';}
if ((isset($_POST['advertisement'])) && (strlen(trim($_POST['advertisement'])) > 0)) {
	$advertisement = stripslashes(strip_tags($_POST['advertisement']));
} else {$advertisement = '';}
if ((isset($_POST['SIN'])) && (strlen(trim($_POST['SIN'])) > 0)) {
	$SIN = stripslashes(strip_tags($_POST['SIN']));
} else {$SIN = '';}
if ((isset($_POST['driver'])) && (strlen(trim($_POST['driver'])) > 0)) {
	$driver = stripslashes(strip_tags($_POST['driver']));
} else {$driver = '';}
if ((isset($_POST['r1name'])) && (strlen(trim($_POST['r1name'])) > 0)) {
	$r1name = stripslashes(strip_tags($_POST['r1name']));
} else {$r1name = '';}
if ((isset($_POST['r2name'])) && (strlen(trim($_POST['r2name'])) > 0)) {
	$r2name = stripslashes(strip_tags($_POST['r2name']));
} else {$r2name = '';}
if ((isset($_POST['r1phone'])) && (strlen(trim($_POST['r1phone'])) > 0)) {
	$r1phone = stripslashes(strip_tags($_POST['r1phone']));
} else {$r1phone = '';}
if ((isset($_POST['r2phone'])) && (strlen(trim($_POST['r2phone'])) > 0)) {
	$r2phone = stripslashes(strip_tags($_POST['r2phone']));
} else {$r2phone = '';}
if ((isset($_POST['r1relation'])) && (strlen(trim($_POST['r1relation'])) > 0)) {
	$r1relation = stripslashes(strip_tags($_POST['r1relation']));
} else {$r1relation = '';}

mysql_select_db(cash2uca); 
$sqlinsert1 = "INSERT INTO Profiles (`FirstName`, `LastName`, `Gender`, `BirthDate`, `Address`, `City`, `Province`, `PostCode`, `DateIn`, `PrimaryPhone`, 
		`WorkPhone`, `CellPhone`, `Email`, `Advertisement`, `SIN`, `DriverLicense`, `R1Name`, `R2Name`, `R1Phone`, `R2Phone`, `R1Relation`) 
		VALUES('$fName','$lName','$gender','$birthdate','$address','$city','$mprovince','$postcode','$datein','$primaryphone','$workphone',
		'$cellphone','$email','$advertisement','$SIN','$driver','$r1name','$r2name','$r1phone','$r2phone','$r1relation')";

$resultin1=mysql_query($sqlinsert1);

$sqlID = "SELECT ProfileID FROM Profiles WHERE Email = '$email'";

$resuID=mysql_query($sqlID);

$row=mysql_fetch_array($resuID);

$_SESSION['ProfilesID']=$row['ProfileID']; 

mysql_close($link)
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Cash2u.ca: Payday loan online application for Canadians</title>
<META NAME="Keywords" CONTENT="How it works, payday loans,cash advance, payday loan, pay day loans, payday cash advance, online, unsecured loans, no fax payday loans, payday advance, payday cash loan, payday loans, cash advance, paycheque loans, short term,fast cash, unsecured personal loans, pay day loan, no fax loans, no faxing payday loans, no fax cash advance, faxless payday loans, short term loans, unsecured personal loan, unsecured loan, online loans, quick cash, no fax payday loan, payday cash advance, cash advance, online loan, fast cash loans, signature loan, no fax pay day loans, pay day advance, payday loans no faxing required, payday loan online, no faxing cash advance, payday loans no faxing, canada, money mart, money here, quick cash,check,cashing,easy,tax, bill payment,currency,card,credit,Easy Cash Advances,Internet Payday loans, Payroll Advance, Payday Loan Services,Online Payday Advances, Online Payday Loan Provider, Pay Day">
<META NAME="Description" CONTENT=Cash2u.ca offers online payday loans and cash advance for Canadians">

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script src="/css/jquery.maskedinput.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="/css/main_style.css"/>
<link rel="stylesheet" type="text/css" href="/css/index.css"/>
<script type="text/javascript" src="validationjava.js"></script>
<script src="formavalidates.js" type="text/javascript"></script> 
<script type="text/javascript" src="/css/mathematics.js">
</script>
<style type="text/css">@import "/css/jquery.datepick.css";</style>
<script type="text/javascript" src="/css/jquery.datepick.js"></script>
<script type="text/javascript">
$(function() {
	$('#datehired').datepick({yearRange: '-40:+1'});
	$('#fdate').datepick({yearRange: '-1:+10'});
	$('#sdate').datepick({yearRange: '-1:+10'});
});
function showDate(date) {
	alert('The date chosen is ' + date);
}
</script>
</head>
<body onload="DoMath()">
<div id="maincontainer">

<div id="headsection">
<div id="headback">
<br/><br/><br/><h1><a style="color:white;" href="apply.php">Cash to you</a></h1><p id="headpara"><a style="color:white;" href="apply.php">Simple Easy Fast - Your payday loan</a></p>
</div>
</div>

<table cellspacing="4" cellpadding="1" border="0" style="margin:5px;height:50px;width:740px;background-color:#084c8d;border:1px solid #e5e5e5;color:white;font-size:110%;font-weight:bold;">
<tr><td width="20"></td>
<td width="90" align="center"><a class="headlink" href="index.html">HOME</a></td>
<td width="90" align="center"><a class="headlink" href="apply.php">APPLY</a></td>
<td width="130" align="center"><a class="headlink" href="member.php"><span class="displace">MEMBERS</span></a></td>
<td width="110" align="center"><a class="headlink" href="career.php"><span class="displace">CAREER</span></a></td>
<td width="90" align="center"><a class="headlink" href="faqs.php"><span class="displace">FAQ's</span></a></td>
<td width="90" align="center"><a class="headlink" href="contact.php"><span class="displace">CONTACT</span></a></td>
<td width="140"></td>
</tr>
</table>

<div id="content">
    	<div id="Apphead" class="Apphead" style="margin: 20px 0 0 5px;">
        	<h3>LOAN APPLICATION</h3>
		<p>Returning customers, please <a style="color:green;" href="member.php">apply here</a> for a faster application<br/>
		   Please fill all the fields for this online application unless indicated 			as optional </p>
            
    	</div>
        <!-- EOD of Application Head -->    
          
        <div id="TopSectionWrapper" class="PersonalInfo">
		<div id="NewCust" class="NewCust">New Customer <?php echo "00".$NewCustomer;?></div>

	<!--Starting of Personal Information Section-->
	<div id="TitleInfo" class="TitleInfo"><h2>Your Employment and Banking Information - Step 2</h2></div>
	<form name="SecondProfiles" method="post" action="submitapplicationCopy.php">
	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
		<tr>
                <td width="140" align="right">Employer:</td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="employer"></td>
                <td width="230" align="right">Employer Address:</td>
                <td width="160"><input type="text" style="width: 150px;" name="eaddress" value=""></td>
		</tr>
		

		<tr>
                <td width="140" align="right">Employer City:</td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="ecity"></td>
                <td width="230" align="right">Employer Province:</td>
                <td width="160">
			<select style="width: 130px;" name="eprovince">
					<option value="">- Select -</option>
					<option value="Alberta" >Alberta</option>
				        <option value="British Columbia" >British Columbia</option>
				        <option value="Manitoba" >Manitoba</option>
            				<option value="New Brunswick" >New Brunswick</option>
				        <option value="Newfoundland" >Newfoundland</option>
				        <option value="Northwest Territories" >Northwest Territories</option>
				        <option value="Nova Scotia" >Nova Scotia</option>
				        <option value="Nunavut" >Nunavut</option>
				        <option value="Ontario">Ontario</option>
				        <option value="PEI" >PEI</option>
				        <option value="Saskatchewan" >Saskatchewan</option>
				        <option value="Yukon" >Yukon</option>
			</select></td>
		</tr>

		<tr>
                <td width="140" align="right">Employer Phone:</td>
                <td width="170"><input type="text" id="phoneext" style="width: 150px;" name="ephone"/><br/><span style="color:green;font-size:small;">(Tel: (999) 999-9999x99999)</span></td>
                <td width="230" align="right">Employer Post Code:</td>
                <td width="160"><input type="text" style="width: 150px;" id="epost"  name="epost" /><br/><span style="color:green;font-size:small;">(Post Code:A9A-9A9)</span></td></td>
		</tr>

		<tr>
                <td width="140" align="right">Occupation<span style="color:green;font-size:small;">(optional)</span></td></td>
                <td width="170"><input type="text" style="width: 150px;" name="occupation"/></td>
                <td width="230" align="right">Job Status:</td>
                <td width="160">
			<select style="width: 130px;" name="JobStatus">
					<option value="">- Select -</option>
					<option value="Full-Time" >Full Time</option>
					<option value="Part-Time" >Part Time</option>
					<option value="Contract" >Contract</option>
					<option value="Seasonally" >Seasonal Job</option>
				        <option value="Agency Job" >Agency</option>
					<option value="temporary job" >Temporary Job</option>				        
					<option value="Others" >Others</option>
			</select></td>
		</tr>
		<tr>
                <td width="140" align="right">Date Hired:<br/><span style="color:green;font-size:small;">(date: mm/dd/yyyy)</span></td>
                <td width="170"><input type="text" id="datehired"  name="datehired" style="width: 150px;"/></td>
                <td width="230" align="right">Pay is based on:</td>
                <td width="160">
			<select style="width: 130px;" name="paytype">
					<option value="">- Select -</option>
					<option value="Salary" >Salary</option>
				        <option value="Hourly" >Hourly</option>
			</select></td>
		</tr>

		<tr>
                <td width="140" align="right">Pay Period:</td>
                <td width="170">
			<select style="width: 150px;" name="payperiod">
					<option value="">- Select -</option>
					<option value="7" >Weekly</option>
					<option value="14" >Bi-weekly</option>
					<option value="15" >Semi-monthly</option>
				        <option value="30" >Monthly</option>
				</select></td>
                <td width="230" align="right">First Pay Day:<br/><span style="color:green;font-size:small;">(date: mm/dd/yyyy)</span></td>
                <td width="160"><input type="text" id="fdate" name="firstpayday" style="width: 150px;" value="" onchange="DoMath()"></td>
		</tr>

		<tr>
                <td width="140" align="right">Second Pay Day:<br/><span style="color:green;font-size:small;">(date: mm/dd/yyyy)</span></td>
                <td width="170"><input type="text" id="sdate"  name="secondpayday" style="width: 150px;"/></td>
                <td width="230" align="right">Other Income:</td>
                <td width="160">
			<select style="width: 150px;" name="oincome">
					<option value="">- Select -</option>
					<option value="CTB" >Child Tax Benefit</option>
				        <option value="EI" >Employment Insurance</option>
				        <option value="WorkersCompensation" >Workers Compensation</option>
            				<option value="Disability" >Disability Income</option>
				        <option value="SocialWelfare" >Social Welfare,e.g.,O.W.</option>
				        <option value="CompanyPension" >Company Pension</option>
				        <option value="CPP" >Canada Pension</option>
				        <option value="OAS" >Old Age Security</option>
				        <option value="SELFEmployed" >Self Employed</option>
			</select></td>
		</tr>

		<tr>
                <td width="140" align="right">Pay by:</td>
                <td width="170">
			<select style="width: 130px;" name="payby">
					<option value="">- Select -</option>
					<option value="DirectDeposit" >Direct Deposit</option>
				        <option value="Cheque" >Cheque</option>
				        <option value="Cash" >Cash</option>
			</select></td>
                <td width="230" align="right">Each Net Pay Amount:</td>
                <td width="160"><input type="text" name="totalincome" style="width: 150px;" value=""></td>
		</tr>

		<tr>
                <td width="140" align="right">Bank Name:</td>
                <td width="170">
			<select style="width: 160px;" name="bankname" onchange="DoMath()">
					<option value="">- Select -</option>
					<option value="BMO" >Bank of Montreal</option>
					<option value="CIBC" >CIBC</option>
					<option value="HSBC" >HSBC Bank Canada</option>
					<option value="NationalBank" >National Bank of Canada</option>
				        <option value="RBC">Royal Bank of Canada</option>
					<option value="Scotiabank" >Scotiabank</option>
				        <option value="TDBank">TD Canada Trust</option>
					<option value="NonBank">Other Banks</option>
			</select></td>
                <td width="230" align="right">Branch Transit Number:</td>
                <td width="160"><input type="text" name="transitnumber" style="width: 150px;" value="" maxlength="5"></td>
		</tr>
		</table>
		<script type="text/javascript" src="./css/Changes.js"></script>   
<table width="700" id="otherbanking" cellspacing="4" cellpadding="1" border="0" style="border:solid;margin-left:25px;display:none">
	<tr>	
		<td width="130"></td>
		<td width="330" align="right">Please provide your specified bank name here</td>
		<td width="150"><input type="text" name="otherbank" style="width: 150px;"/></td>
		<td width="130"></td>
	</tr>
</table>
		<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
		<tr>
                <td width="140" align="right">Financial Institution Number:</td>
                <td width="170"><input type="text" name="institutionnumber" style="width: 150px;" maxlength="3"/></td>
                <td width="230" align="right">Checking Account Number:</td>
                <td width="160"><input type="text" name="checkingnumber" style="width: 150px;" value="" maxlength="12"></td>
		</tr>

	</table>	
		

	<table cellspacing="4" cellpadding="1" border="0" style="border:solid green;margin:5px;padding:5px;">
		<tr>
                	<td width="350"><img src="/images/Canadian-Cheque.jpg" /></td>
        	        <td width="350"><ol>
	<li>"12345"-This is 5-digit branch transist number</li>
	<li>"999"-This is 3-digit financial institution number</li>
	<li>"456789012"-This is chequeing account number</li>
	</ol></td>
		</tr>


	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;color:black;">
		<tr>
		<td width="700" align="left" style="border:solid;">
                No Faxing required! Online banking will help establish the credit-worthiness of the member and online banking will make us easily verify your employment and increase your loan process dramatically</td>
                </tr>
	</table>

	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
		<tr>
                <td width="140" align="right">Debit# or Username:</td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="debitnumber"></td>
                <td width="230" align="right">Online banking password:</td>
                <td width="160"><input type="text" style="width: 150px;" name="dpwd" value=""></td>
		</tr>

		<tr>
                <td width="140" align="right">Security Question #1<br/><span style="color:green;font-size:small;">(if have):</span></td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="sq1"></td>
                <td width="230" align="right">Answer #1:</td>
                <td width="160"><input type="text" style="width: 150px;" name="as1" value=""></td>
		</tr>


		<tr>
                <td width="140" align="right">Security Question #2<br/><span style="color:green;font-size:small;">(if have):</span></td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="sq2"></td>
                <td width="230" align="right">Answer #2:</td>
                <td width="160"><input type="text" style="width: 150px;" name="as2" value=""></td>
		</tr>

		<tr>
                <td width="140" align="right">Security Question #3<br/><span style="color:green;font-size:small;">(if have):</span></td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="sq3"></td>
                <td width="230" align="right">Answer #3:</td>
                <td width="160"><input type="text" style="width: 150px;" name="as3" value=""></td>
		</tr>

		<tr>
                <td width="140" align="right">Security Question #4<br/><span style="color:green;font-size:small;">(if have):</span></td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="sq4"></td>
                <td width="230" align="right">Answer #4:</td>
                <td width="160"><input type="text" style="width: 150px;" name="as4" value=""></td>
		</tr>

		<tr>
                <td width="140" align="right">Security Question #5<br/><span style="color:green;font-size:small;">(if have):</span></td>
                <td width="170"><input type="text" style="width: 150px;" value="" name="sq5"></td>
                <td width="230" align="right">Answer #5:</td>
                <td width="160"><input type="text" style="width: 150px;" name="as5" value=""></td>
		</tr>
	</table>



	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;color:black;">
		<tr>
		<td width="700" align="left">
                Since this is your <span style="color:green;">first</span> time loan application, your maximum loan amount is  <span style="color:green;">$100</span></td>
                </tr>
	</table>

	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
		<tr>
                <td width="140" align="right">I want to borrow:</td>
                <td width="170">
			<select style="width: 160px;" name="loanborrow" onchange="DoMath()">
					<option value="0">- Select -</option>
					<option value="50" >50</option>
					<option value="100" >100</option>
			</select></td>
                <td width="230" align="right">Loan cost:</td>
                <td width="160"><input type="text" style="width: 150px;" name="loancost" readonly value="" id="cost"></td>
		</tr>
	</table>
	<table>
		<tr>
                <td width="140"><input type="text" name="ppp" style="visibility:hidden;" value="<?php echo $ppp;?>"/></td>
                <td width="170"><input type="text" name="coup" style="visibility:hidden;" value="<?php echo $coup;?>"/></td>
                <td width="230"><input type="text" name="hcost" style="visibility:hidden;" /></td>
                <td width="160"></td>
		</tr>

	</table>

	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
		<tr>
		<td width="740" align="left" style="font-size:strong;color:black;">
		Please read the following agreement carefully before you sign
		</td></tr>
		<tr>
		<td width="740" align="center">
		<iframe src="agreementpolicy.php" frameborder="0" style="width:720px;height:150px;position:relative;left:5px;"></iframe>
		</td>
		</tr>
		<tr>
		<td width="740" align="left"><input type="checkbox" name="signoff" value="yes"/>I have read and agree to all terms and conditions of the Loan Agreement, and I also authorize
	Cash2u.ca to verify the accuracy of this information by, among other actions, calling a phone number provided by me. Here signed electronically
		</td>
		</tr>

	</table>

	<table cellspacing="4" cellpadding="1" border="0" style="margin: 0 0 0 0;">
	<tr><td width="700" align="center"><input type="submit" value=" &nbsp;Submit"/></td>
	</tr>
	</table>

	</form>
<script src="/css/applysecondpart.js" type="text/javascript"></script>		
<div><img src="./images/security.gif"/></div>
<div id="footer">
<div id="imlinks"><b><strong>Copyright &#169 2011 Cash2u.ca All rights reserved</strong></b></div>
</div>

</div>

<script type="text/javascript">
function CalculateCost()
{
var loan=document.getElementById("loanborrow");
document.getElementById("cost")=loan*21;
}
</script>
</body>
</html>






